package com.xm.settlement.service.impl;

import com.baomidou.framework.service.impl.SuperServiceImpl;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.xm.settlement.commons.utils.PageInfo;
import com.xm.settlement.mapper.UserExpansionMapper;
import com.xm.settlement.model.AppService;
import com.xm.settlement.model.UserExpansion;
import com.xm.settlement.model.vo.UserExpansionVo;
import com.xm.settlement.service.UserExpansionService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2017/4/21.
 */
@Service
public class UserExpansionServiceImpl extends SuperServiceImpl<UserExpansionMapper,UserExpansion> implements UserExpansionService {

    @Autowired
    private UserExpansionMapper userExpansionMapper;

    @Override
    public Integer selectSum(UserExpansion userExpansion) {
      return   userExpansionMapper.selectSum(userExpansion);
    }

    @Override
    public void updateAvgScore(double avgScore) {
        userExpansionMapper.updateAvgScore(avgScore);
    }

    @Override
    public void reduceIncrement( Integer mut) {
        userExpansionMapper.reduceIncrement(mut);
    }

    @Override
    public List<UserExpansionVo> selectUserExpansionVoList(UserExpansionVo o) {
        return userExpansionMapper.selectUserExpansionVoList(o);
    }

    @Override
    public void selectDataGrid(PageInfo pageInfo) {
        Page<AppService> page = new Page<AppService>(pageInfo.getNowpage(), pageInfo.getSize());
        EntityWrapper entityWrapper = new EntityWrapper();
        List<AppService> list = userExpansionMapper.selectList(entityWrapper);
        pageInfo.setRows(list);
        pageInfo.setTotal(page.getTotal());
    }
}
